import React from 'react'
import BookApi from './BookApi'
import Appearance from './Appearance'
import { netError } from './Errors'
import persist from './persist'
import Search from './Search'

export const stores = {
  bookApi: new BookApi(),

  appearance: new Appearance(),

  search: new Search(),

  persist,

  netError,
}

const ctx = React.createContext(stores)
export const useStores = () => React.useContext(ctx)